/**
 * @param {string} moves
 * @return {boolean}
 */
var judgeCircle = function (moves) {
  var UD = 0;
  var RL = 0;
  var arr = moves.split('')
  var type = {
    'R': () => RL++,
    'L': () => RL--,
    'U': () => UD++,
    'D': () => UD--
  }
  for (let i of arr) {
    type[i]()
  }
  return UD === 0 && RL === 0
};